﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataLayer
{
    public class dlusers
    {
        public DataSet UserList()
        {
            string connStr = ConfigurationManager.ConnectionStrings["constring"].ConnectionString;
            string querystring = @"select * from Users inner join Roles on Users.RoleId = Roles.RolesId inner join TeamUser on Users.UserID = TeamUser.UserId";

            SqlConnection connection = new SqlConnection(connStr);
            SqlCommand querylogin = new SqlCommand(querystring, connection);

            SqlDataAdapter myadapter = new SqlDataAdapter(querylogin);
            DataSet mydataset = new DataSet();

            myadapter.Fill(mydataset);

            return mydataset;
        }
        public DataSet UserListTeamless()
        {
            string connStr = ConfigurationManager.ConnectionStrings["constring"].ConnectionString;
            string querystring = @"select * from Users inner join Roles on Users.RoleId = Roles.RolesId";

            SqlConnection connection = new SqlConnection(connStr);
            SqlCommand querylogin = new SqlCommand(querystring, connection);

            SqlDataAdapter myadapter = new SqlDataAdapter(querylogin);
            DataSet mydataset = new DataSet();

            myadapter.Fill(mydataset);

            return mydataset;
        } 
    }
}
